#ifndef __BASE_PUMPKIN_BLOCK_H__
#define __BASE_PUMPKIN_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{    
    // 南瓜基类
    class BasePumpkinBlock : public Block
    {
	public:
		bool isRotten;
    public:
		BasePumpkinBlock(bool rotten);

        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;
        virtual void getDropValues(int32_t oldValue, int32_t newValue, int32_t toolLevel, std::vector<BlockDropValue> &dropValues) override;
        virtual const std::vector<BoundingBox> &getCustomCollisionBoxes(int32_t value) override;

		virtual float getNutritionalValue(int32_t value) override;
        virtual int32_t getDamage(int32_t value) override;
        virtual int32_t setDamage(int32_t value, int32_t damage) override;
        virtual int32_t getDamageDestructionValue(int32_t value) override;
		virtual int32_t getRotPeriod(int32_t value) override;

		static inline int32_t GetSize(int32_t data);
		static inline int32_t SetSize(int32_t data, int32_t size);
		static inline bool GetIsDead(int32_t data);
		static inline int32_t SetIsDead(int32_t data, bool isDead);
		
    };

	inline int32_t BasePumpkinBlock::GetSize(int32_t data)
	{
		return 7 - (data & 7);
	}

	inline int32_t BasePumpkinBlock::SetSize(int32_t data, int32_t size)
	{
		return (data & -8) | (7 - (size & 7));
	}

	inline bool BasePumpkinBlock::GetIsDead(int32_t data)
	{
		return (data & 8) != 0;
	}

	inline int32_t BasePumpkinBlock::SetIsDead(int32_t data, bool isDead)
	{
		if (!isDead)
		{
			return data & -9;
		}
		return data | 8;
	}

} // namespace PocketSurvival


#endif
